package com.gvfish.entity;

import java.io.Serializable;
import java.util.Date;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import org.apache.commons.lang.builder.ToStringBuilder;

import com.google.appengine.api.datastore.Text;
import com.gvfish.backingbean.LinkInput;

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Link implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Long id;
	@Persistent
	private String siteName;

	@Persistent
	private String url;
	@Persistent
	private String email;

	/**
	 * 是否通过审核
	 */
	@Persistent
	private Boolean state;

	@Persistent
	private Date addDate;

	@Persistent
	private Text describe;

	public Link() {
		this.addDate = new Date();
	}

	public Link(String siteName, String url, String email) {
		this.siteName = siteName;
		this.url = url;
		this.email = email;
		this.addDate = new Date();
	}

	public Link(LinkInput linkInput) {
		this.siteName = linkInput.getSiteName();
		this.url = linkInput.getUrl();
		this.email = linkInput.getEmail();
		this.addDate = new Date();
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getEmail() {
		return email;
	}


	public void setAddDate(Date addDate) {
		this.addDate = addDate;
	}

	public Date getAddDate() {
		return addDate;
	}

	public void setDescribe(Text describe) {
		this.describe = describe;
	}

	public Text getDescribe() {
		return describe;
	}

	public void setSiteName(String siteName) {
		this.siteName = siteName;
	}

	public String getSiteName() {
		return siteName;
	}

	public void setState(Boolean state) {
		this.state = state;
	}

	public Boolean getState() {
		return state;
	}
	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}

}
